package com.taskcollection.compsite;

import java.util.List;

/**
 * Created by Administrator on 2016/8/7 0007.
 */
public class test {
    public static void main(String[] args){
        Compsites c = new Compsites(0);
        Leaf l = new Leaf(1);
        c.add(l);
        Compsites c1 = new Compsites(1);
        c.add(c1);
        Leaf l2 = new Leaf(2);
        c1.add(l2);
        Leaf l1 = new Leaf(1);
        c.add(l1);
        see(c.getCom());
    }
    public static void see(List<CompsiteInterface> com){
        for(CompsiteInterface c:com){
            c.op();
            try{
                Compsites temp = (Compsites)c;
                if(temp!=null){
                    see(temp.getCom());
                }
            }catch (ClassCastException e){

            }

        }
    }
}
